﻿namespace PrismEx.Distributed.Channels
{
    using System.ServiceModel;
    using System.ServiceModel.Description;

    using PrismEx.Distributed.Interfaces;

    public class Class1
    {
        public void x()
        {
            var serviceType = typeof(IDistributedEventService).FullName;
            var serviceEndpoint = new ServiceEndpoint(
                new ContractDescription(serviceType),
                new NetPeerTcpBinding { Security = new PeerSecuritySettings { Mode = SecurityMode.None } },
                new EndpointAddress("net.p2p://PrismEx/DistributedEvent"));

            var instanceContext = new InstanceContext(this);
            var channelFactory = new DuplexChannelFactory<IDistributedEventChannel>(instanceContext, serviceEndpoint);
            var channel = channelFactory.CreateChannel();
        }

    }
}